void httpHandle(int fd)
{
    getLine(fd);

    char* query_string = NULL;
    parseMQ(_buf, _method, sizeof(_method), _queue_name, sizeof(_queue_name));

    zipInit(_headers, sizeof(_headers));

    int n;
    while (1) {
        n = getLine(fd);
        if (n <= 0 || strcmp("\n", _buf) == 0)
            break;
        parseKV(_buf, _key, 128, _value, 256);
        zipAdd(_headers, _key, _value);
    }

    char *config_auth = getConfig("queue_auth");
    int status = 0;
    if (config_auth != NULL) {
        char *client_auth = zipGet(_headers, "Auth");
        if (client_auth == NULL || strcmp(config_auth, client_auth)) {
            status = 20;
        }
    }

    httpCommand *cmd = dictGet(_commands, _method);
    if (cmd == NULL)
        status = 10;

    if (status == 0)
        cmd->proc(fd);
    else
        httpReply(fd, status, _queue_name, -1,  NULL);

    discardLeft(fd);
    close(fd);
}

